var $;
var from;
var wellids;
var name;
layui.use(['form', 'colorpicker', 'layer'], function () {
  $ = layui.$;
  from = layui.form;
  var colorpicker = layui.colorpicker;
  var layer = layui.layer;
  $("#ig1").click(function () {
    var well = wellids;
    layer.open({
      type: 2,
      title: "岩性图片",
      content: './Images.html',
      area: ['450px', '400px'],
      btn: ['确认'],
      success: function (layero, index) {
        var iframe = window["layui-layer-iframe" + index]
        iframe.imglist(well, name);
      },
      yes: function (index) {
        var res = window["layui-layer-iframe" + index].resdate();
        $("#img1").attr("src", res.pic)
        $("#img1").attr("title", res.code)
        layer.close(index)
      }
    })
  })
  $("#ig2").click(function () {
    var well = wellids;
    layer.open({
      type: 2,
      title: "岩性图片",
      content: './Images.html',
      area: ['450px', '400px'],
      btn: ['确认'],
      success: function (layero, index) {
        var iframe = window["layui-layer-iframe" + index]
        iframe.imglist(well, name);
      },
      yes: function (index) {
        var res = window["layui-layer-iframe" + index].resdate();
        $("#img2").attr("src", res.pic)
        $("#img2").attr("title", res.code)
        layer.close(index)
      }
    })
  })

})
function child(wellid, dbname) {
  wellids = wellid;
  name = dbname;
}
var resdate = function () {
  var depthstart1 = $("#de1").val();
  var depthend1 = $("#de2").val();
  var ty1 = $("#img1").attr('title')
  if (ty == "") {
    ty = "99"
  }

  var depthstart = $("#dep3").val();
  var depthend = $("#dep4").val();
  var ty = $("#img2").attr('title')
  if (ty == "") {
    ty = "99"
  }
  let date;
  if (depthstart == "" || depthend == "") {
    date = true;
  } else {
    date = { depthstart, depthend, ty }
  }
  return date;
}